package com.zhilianbao.leyaogo.view.dialog;

import android.content.Context;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.bql.variousdialog.widget.base.BaseDialog;
import com.zhilianbao.leyaogo.R;
import com.zhilianbao.leyaogo.utils.Utils;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * ClassName: ProgressDialog1 <br>
 * Description: 进度对话框<br>
 * Author: Cyarie <br>
 * Created: 2016/11/21 19:23 <br>
 * Update Time：<br>
 * Update Description：<br>
 */
public class DownLoadProgressDialog extends BaseDialog<DownLoadProgressDialog> {

    @BindView(R.id.pb_loading)
    ProgressBar pbLoading;
    @BindView(R.id.tv_download_progress)
    TextView tvDownloadProgress;
    @BindView(R.id.tv_download_max_progress)
    TextView tvDownloadMaxProgress;

    public DownLoadProgressDialog(Context context) {
        super(context);
    }

    @Override
    public View onCreateView() {
        widthScale(0f);
        View view = View.inflate(mContext, R.layout.dialog_download_progress, null);
        ButterKnife.bind(this, view);
        //        view.setBackgroundDrawable(
        //                CornerUtils.cornerDrawable(Color.parseColor("#ececec"), dp2px(6)));
        return view;
    }

    public void showText(String downloadProgress,String downloadMax) {
        tvDownloadProgress.setText(downloadProgress);
        tvDownloadMaxProgress.setText(downloadMax);
    }

    @Override
    public void setUiBeforeShow() {
//        getWindow().setDimAmount(0.25f);
        setCanceledOnTouchOutside(false);
        //        mIvLoading.setBackgroundResource(R.drawable.loading_more);
        //        mAnimationDrawable = (AnimationDrawable) mIvLoading.getBackground();
        //        mAnimationDrawable.mutate();
        //        mAnimationDrawable.start();

    }


    //重写系统返回键处理
    @Override
    public void onBackPressed() {
        if (isShowing()) {
            return;
        }
        super.onBackPressed();
    }
}
